package utils

import (
	"fmt"
	"runtime"
	"sync"
	"time"
)

var once sync.Once

// 查询当前Goroutine数量, 只运行一次
func GoroutineNum() {
	once.Do(func() {
		go func() {
			for {
				n := runtime.NumGoroutine()
				fmt.Println("当前Goroutine数量:", n)
				time.Sleep(time.Second * 2)
			}
		}()
	})
}
